'use strict';
/** @type {import('sequelize-cli').Migration} */
module.exports = {
  async up(queryInterface, Sequelize) {
    await queryInterface.createTable('system_menu', {
      id: {
        allowNull: false,
        autoIncrement: true,
        primaryKey: true,
        type: Sequelize.INTEGER
      },
      system_permission_id: {
        type: Sequelize.INTEGER,
        allowNull: false,
        comment: '关联权限id，菜单是对应权限的'
      },
      parent_id: {
        type: Sequelize.INTEGER,
        allowNull: false,
        defaultValue: 0,
        comment: '父级id'
      },
      name: {
        type: Sequelize.STRING(45),
        allowNull: false,
        defaultValue: '',
        comment: '菜单名称'
      },
      icon: {
        type: Sequelize.STRING(45),
        allowNull: false,
        defaultValue: '',
        comment: '展示icon'
      },
      path: {
        type: Sequelize.STRING(45),
        allowNull: false,
        defaultValue: '',
        comment: '访问路由'
      },
      view: {
        type: Sequelize.STRING(100),
        allowNull: false,
        defaultValue: '',
        comment: '文件路径'
      },
      sort: {
        type: Sequelize.TINYINT,
        allowNull: false,
        defaultValue: 0,
        comment: '排序'
      },
      additional: {
        type: Sequelize.STRING,
        allowNull: false,
        defaultValue: '',
        comment: '附加字段'
      },
      description: {
        type: Sequelize.STRING,
        allowNull: false,
        defaultValue: '',
        comment: '菜单描述'
      },
      status: {
        type: Sequelize.TINYINT,
        allowNull: false,
        defaultValue: 1,
        comment: '1:显示，2：隐藏'
      },
      created_at: {
        allowNull: false,
        type: Sequelize.DATE
      },
      updated_at: {
        allowNull: false,
        type: Sequelize.DATE
      }
    });
  },
  async down(queryInterface, Sequelize) {
    await queryInterface.dropTable('system_menu');
  }
}